#ifndef __CREATURE_H__
#define __CREATURE_H__

// #include <wiisprite.h>
#include <vector>

#include "Entity.h"

using namespace wsp;
using namespace std;

enum Direction
{
	DIR_LEFT,
	DIR_UP,
	DIR_DOWN,
	DIR_RIGHT
};

/* 
 * This will be the ancestor of both "link" and foes.
 * It will handle the multiple animations that a sigle thing will have, depending on it's direction.
 * It will call sprite.SetFrameSequence(direction[current_dir], direction[current_dir].size())
 * when it's direction changes.  Feel free to suggest better names for stuff now, 
 * before those names get used everywhere.
 *
 * The idea is that some engine will call update() on all the existing objects.  Each object will signal 
 * to the engine that it is dead/done by returning false from update.
 */
class Creature :public Entity
{
public:
	Creature();	
	~Creature();
	
	bool Update();  // If false, destroy it, it's done.	
	
	void OnHit();  // Perhaps include what hit it?
	
	
	
	Sprite GetSprite();
	void SetSprite(Sprite spr);
	
	
	void SetImage(Image * img, u32 tileWidth=0, u32 tileHeight=0);	
	const Image* GetImage() const;	
			
	
	/* Could move these up to Entity?  Or at lest, as virtual funtions.
	 * All the position methods you pass through to the sprite.
	 * Will add more as needed.  See libwiisprite/layer.h and sprite.h
	 */
	void SetPosition(f32 x, f32 y);
	void MovePosition(f32 x, f32 y);  // Does sprite stuff now.
	
	
	
	
	void SetSequences(vector<u32> seq[], u32 size=4);  //Might want to change that, or overload it.
	void SetSequences(vector<u32> left, vector<u32> up,
					vector<u32> down, vector<u32>right);
	void SetSequences(u32 left[], u32 sLeft, u32 up[], u32 sUp,
					u32 down[], u32 sDown, u32 right[], u32 sRight);	
	
	
	void SetFrameWait(u32 wait);
	
	
	// This calls the sprite's SetFrameSequence with the corrisponding vector in sequences.
	void Face (Direction dir);
	
	
	
	
	
	
	Sprite sprite;
	
	u32 ticker, frameWait;
	
	std::vector<u32> sequences[4];  // Could also only have 3, since left and right are mirror images.
	Direction currentDir, lastDir;
	bool moving;
	
	/* Inherited attributes
	 *
	 * bool alive;
	 * Layer * layer;
	 *
	 */



};

#endif//__CREATURE_H__